package com.cnhis.cloudhealth.clinical.util;
//package com.cnhis.cloudhealth.commons.aoplog.util;
//
//import org.springframework.beans.BeansException;
//import org.springframework.beans.factory.DisposableBean;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.ApplicationContextAware;
//import org.springframework.context.support.ClassPathXmlApplicationContext;
//import org.springframework.context.support.FileSystemXmlApplicationContext;
//
//import com.cnhis.cloudhealth.commons.aoplog.anno.annoTest;
//
//  
//
//
//public class SpringUtil implements ApplicationContextAware, DisposableBean {
//
//	public static ApplicationContext applicationContext = null;
//
//	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
//		System.out.println("==");
//		SpringUtil.applicationContext = applicationContext;
//	}
//	
//	public void destroy() throws Exception {
//		applicationContext = null;
//	}
//
//	/**
//	 * 获取applicationContext
//	 * 
//	 * @return applicationContext
//	 */
//	public static ApplicationContext getApplicationContext() {
//		return applicationContext;
//	}
//
//	/**
//	 * 根据Bean名称获取实例
//	 * 
//	 * @param name
//	 *            Bean注册名称
//	 * 
//	 * @return bean实例
//	 * 
//	 * @throws BeansException
//	 */
//	public  static Object getBean(String name) throws BeansException {
//		
//		iniAppContext();
//		// applicationContext.getBean
//		return applicationContext.getBean(name);
//	}
// public static  String[] locations ;
////public  static <ati> ati getBean(Class<ati>  cls) throws BeansException {
////		
////		iniAppContext();
////		// applicationContext.getBean
////		return applicationContext.getBean(cls);
////	}
// 
// static String cfgFileDir;
//	private  synchronized static void iniAppContext() {
//		if(applicationContext==null)
//		{
//			//applicationContext-*.xml
//		 //	applicationContext = new ClassPathXmlApplicationContext("applicationContext-atti.xml");
//			
//		//	=pathx.classPath()+"/";
//			// core.log("--o5d path:"+p);
//			 //path:/d:/workspace/Gialen/WebRoot/WEB-INF/classes/
//			 if(locations==null)
//			    locations =new  String[] {  cfgFileDir+"IocSrpingCfg.xml",     cfgFileDir+"applicationContext-actions.xml",cfgFileDir+ "applicationContext-common.xml",cfgFileDir+ "applicationContext-daos.xml",cfgFileDir+"applicationContext-services.xml",cfgFileDir+"applicationContext-zhoujb.xml"};
//			   applicationContext = new FileSystemXmlApplicationContext(locations );
//		
//		//	applicationContext= new FileSystemXmlApplicationContext(p);
//		}
//	}
//	 
////	public  synchronized static void iniAppContext() {
////		if(applicationContext==null)
////		{
////			//applicationContext-*.xml
////		 //	applicationContext = new ClassPathXmlApplicationContext("applicationContext-atti.xml");
////			
////		//	=pathx.classPath()+"/";
////			// core.log("--o5d path:"+p);
////			 //path:/d:/workspace/Gialen/WebRoot/WEB-INF/classes/
////			 if(locations==null)
////			    locations =new  String[] {  cfgFileDir+"IocSrpingCfg.xml",     cfgFileDir+"applicationContext-actions.xml",cfgFileDir+ "applicationContext-common.xml",cfgFileDir+ "applicationContext-daos.xml",cfgFileDir+"applicationContext-services.xml",cfgFileDir+"applicationContext-zhoujb.xml"};
////			   applicationContext = new FileSystemXmlApplicationContext(locations );
////		
////		//	applicationContext= new FileSystemXmlApplicationContext(p);
////		}
////	}
//	private  synchronized static void iniAppContext( String[] locations) {
//		if(applicationContext==null)
//		{
//			//applicationContext-*.xml
//		 //	applicationContext = new ClassPathXmlApplicationContext("applicationContext-atti.xml");
//			
//			String p=pathx.classPath()+"/";
//		//	 core.log("--o5d path:"+p);
//			 //path:/d:/workspace/Gialen/WebRoot/WEB-INF/classes/
//		//	   = {p+"applicationContext-actions.xml",p+ "applicationContext-common.xml",p+ "applicationContext-daos.xml",p+"applicationContext-services.xml",p+"applicationContext-zhoujb.xml"};
//			   applicationContext = new FileSystemXmlApplicationContext(locations );
//		
//		//	applicationContext= new FileSystemXmlApplicationContext(p);
//		}
//	}
//	
//	
//	public static void main(String[] args) {
//		// attilax 老哇的爪子  上午11:54:26   2014-5-14 
//	//	SpringUtil.cfgFileDir=PathUtil.classPath_hisCommLib()+"/";
//		SpringUtil. locations =new  String[] {  PathUtil.classPath_hisCommLib()+"/"+"IocSrpingCfg.xml"};
//		annoTest bean = (annoTest) getBean("annoTest");
//		bean.someOp(56);
//		System.out.println(bean);
//		System.out.println("--");
//		//branchManagerService
//
//	}
//
//}